package com.gitlab.lucky.weixin.service;

import com.github.pagehelper.PageInfo;
import com.gitlab.lucky.common.dao.mapper.WeixinGzhIntegrationRecordMapper;
import com.gitlab.lucky.common.dao.model.WeixinGzhIntegrationRecord;
import com.gitlab.lucky.common.service.ServiceImpl;
import org.springframework.stereotype.Service;
import tk.mybatis.mapper.entity.Example;

/**
 * @program: lucky
 * @author: Mr.Han
 * @create: 2019-04-02 16:33
 **/
@Service
public class WeixinGzhIntegrationRecordService extends ServiceImpl<WeixinGzhIntegrationRecordMapper, WeixinGzhIntegrationRecord> {
    /**
     * 查询积分流水
     * @param openId
     * @param platform
     */
    public PageInfo<WeixinGzhIntegrationRecord> selectRecordByOpenId(Integer pageNum, Integer pageSize, String openId, Integer platform) {
        Example example = new Example(WeixinGzhIntegrationRecord.class);
        example.createCriteria().andEqualTo("openId",openId).andEqualTo("platform",platform);
        example.orderBy("createTime").desc();
        PageInfo<WeixinGzhIntegrationRecord> weixinGzhIntegrationRecordPageInfo = this.selectPage(pageNum, pageSize, example);
        return weixinGzhIntegrationRecordPageInfo;
    }
}
